package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 取款
 */
public class GetPanel extends JPanel implements ActionListener {
    private AtmGUI atmGUI;
    private JLabel moneyLabel = new JLabel("请输入金额：");
    private JTextField moneyTextField = new JTextField();
    private Font font = new Font("宋体",Font.BOLD,18);
    private JButton sureBtn = new JButton(new ImageIcon("images\\buttonSure.jpg"));
    private JButton offBtn = new JButton(new ImageIcon("images\\buttonOff.jpg"));
    public GetPanel(AtmGUI atmGUI){
        this.atmGUI = atmGUI;
        this.setLayout(null);
        this.setOpaque(false);
        moneyLabel.setBounds(300,200,150,50);
        moneyLabel.setFont(font);
        this.add(moneyLabel);
        moneyTextField.setBounds(400,200,250,50);
        moneyTextField.setFont(font);
        this.add(moneyTextField);
        sureBtn.setBounds(800,400,140,50);
        sureBtn.addActionListener(this);
        this.add(sureBtn);
        offBtn.setBounds(0,400,140,50);
        offBtn.addActionListener(this);
        this.add(offBtn);

   }
    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == sureBtn){
        atmGUI.showPanel("menu");
    }else if (e.getSource() == offBtn){
            atmGUI.showPanel("login");
        }
}
}
